import express from "express";
import { run } from "../../../stzb/app";
import stzbModel from "../../../mongo/models/stzb";

const router = express.Router();
// 用户列表
router.post("/stzb/zhan", (req: any, res) => {
  const body = req.body;

  let a = JSON.parse(body.a);
  let b = JSON.parse(body.b);
  const data = run(a, b);
  const newZb = new stzbModel({ a: body.a, b: body.b, zhanbao: JSON.stringify(data) });
  newZb
    .save()
    .then((res) => {
      console.log(res);
    })
    .catch((err) => {
    //   console.log(err);
    });

  res.send({
    data: data,
  });
});

export default router;
